ActiveReports 10
Reports with Bookmarks
ActiveReports 10 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Page Report/RDL Report Walkthroughs > Preview > Reports with Bookmarks

You can assign a bookmark ID to any report control and link a text box or image to it to allow users to easily navigate between items in the finished report. The bookmark link works like a hyperlink, except that clicking a bookmark link jumps to another page or area of the report instead of to a Web page.

This walkthrough explains the steps involved in setting up bookmarks and links.

The walkthrough is split up into the following activities:

Note:
Note: If you have already created the report outlined in the Reports with XML Data walkthrough, you can open that report and go directly to the Assigning a Bookmark ID section of this walkthrough.

When you complete this walkthrough you get a layout that looks similar to the following at design time and at runtime.

Design Time Layout

Runtime Layout

To add an ActiveReport to a Visual Studio project

  1. Create a new Visual Studio project.
  2. From the Project menu, select Add New Item.
  3. In the Add New Item dialog that appears, select ActiveReports 10 Page Report and in the Name field, rename the file as ExchangeRates.rdlx.
  4. Click the Add button to open a new fixed page report in the designer.

See Adding an ActiveReport to a Project for information on adding different report layouts.

To connect the report to a data source

  1. In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
  2. In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like Factbook.
  3. On this page, check the Shared Reference checkbox.
  4. Click the Browse button and select Factbook.rdsx, which is located in [User Documents folder]\GrapeCity Samples\ActiveReports 10\Data. See Connect to a Data Source for information on connecting to a data source.

To add a dataset

  1. In the Report Explorer, right-click the data source node and select the Add Data Set option or select Data Set from the Add button.
  2. In the DataSet Dialog that appears, select the General page and enter the name of the dataset as ExchangeRates.
  3. On the Query page, enter the following XML path into the Query text box to access data for every country except "World":
    //country [@name != 'World']
  4. On the Fields page, enter the values in the table below to create fields for your report. Values for XML data fields must be valid XPath expressions.
    Field Name Type Value
    Names Database Field @name
    Currencies Database Field ./ExchangeRates/Currency
    2004 Database Field ./ExchangeRates/VsUSD2004
    2003 Database Field ./ExchangeRates/VsUSD2003
    2002 Database Field ./ExchangeRates/VsUSD2002
    2001 Database Field ./ExchangeRates/VsUSD2001
    2000 Database Field ./ExchangeRates/VsUSD2000
  5. Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.  

To add controls to the report

  1. From the toolbox, drag a List data region onto the design surface of the report and go to the Properties window to set the DataSetName property to ExchangeRates, Location property to 0in, 0in and Size property to 6.5in, 3in.
  2. From the Report Explorer, drag the Names field onto the list, center it at the top and go to the Properties window to set the FontSize property to 14pt and the BorderStyle property to Solid.
  3. From the Report Explorer, drag the following fields onto the list with properties set as described in the table below.
    Field Name Property Name
    Currencies Location: 1.125in, 0.5in
    Size: 2.25in, 0.25in
    2004 Location: 4in, 0.875in
    Size: 1in, 0.25in
    2003 Location: 4in, 1.25in
    Size: 1in, 0.25in
    2002 Location: 4in, 1.625in
    Size: 1in, 0.25in
    2001 Location: 4in, 2in
    Size: 1in, 0.25in
    2000 Location: 4in, 2.375in
    Size: 1in, 0.25in
    Note: You will notice that the expressions created for these fields are different than usual. Because Visual Basic syntax does not allow an identifier that begins with a number, any numeric field names must be treated as strings in expressions.
  4. From the toolbox, drag a TextBox onto the list and go to the Properties window to set the properties as described in the table below to combine static text with a field value.
    Property Name Property Value
    Location 0.125in, 0.875in
    Size 3.125in, 0.25in
    Value ="Value of " & Fields!Currency.Value & " versus US$ for year:"
    Font Normal, Arial, 10pt, Bold
    TextAlign Right
  5. From the toolbox, drag TextBox controls onto the list and go to the Properties window to set the properties as described in the table below to create static labels.

    TextBox1

    Property Name Property Value
    Location 0.125in, 0.5in
    Size 0.75in, 0.25in
    FontWeight Bold
    Value Currency:

    TextBox2

    Property Name Property Value
    Location 3.375in, 0.875in
    Size 0.5in, 0.25in
    TextAlign Right
    Value 2004:

    TextBox3

    Property Name Property Value
    Location 3.375in, 1.25in
    Size 0.5in, 0.25in
    TextAlign Right
    Value 2003:

    TextBox4

    Property Name Property Value
    Location 3.375in, 1.625in
    Size 1in, 0.25in
    TextAlign Right
    Value 2002:

    TextBox5

    Property Name Property Value
    Location 3.375in, 2in
    Size 0.5in, 0.25in
    TextAlign Right
    Value 2001:

    TextBox6

    Property Name Property Value
    Location 3.375in, 2.375in
    Size 0.5in, 0.25in
    TextAlign Right
    Value 2000:

To assign a bookmark ID to the report control

A bookmark ID marks any report control as something to which a bookmark link can navigate.

  1. On the designer surface, select the Names textbox at the top of the list and at the bottom of the Properties Window, select the Property dialog command.
  2. In the Textbox dialog that appears, go to the Navigation page.
  3. On the Navigation page, enter Names in the Bookmark ID field.
    Note: Every bookmark ID in a report must be a unique string. If you have duplicates, a link to it will navigate only to the first one it finds.
  4. Click OK to close the dialog.

To add a bookmark link to the report control

A bookmark link is like a hyperlink that navigates to a report control marked with a bookmark ID instead of to a URL. We will add a text box below the list we already created to display at the bottom of the report. This text box will have a bookmark link to the bookmark ID we created in the last procedure.

  1. From the toolbox, drag a text box onto the report below the list and in the Properties window, set the properties as follows.
    Property Name Property Value
    Value Back to Top
    Location 0in, 3in
    Size 6.5in, .5in
    TextAlign Center
  2. At the bottom of the Properties Window, select the Property dialog command.
  3. In the Textbox dialog that appears, go to the Navigation page.
  4. On the Navigation page, select the Jump to Bookmark radio button and enter the bookmark ID (Names) created in the procedure above.
  5. Click OK to close the dialog.

To view the report

Open the report in the Viewer. See Windows Forms Viewer for further information.